< previous page page_478 next page >

Page 478
Listing 12.14. continued
Private Sub UserControl_Resize()
    '
    ' fill out control space with button
    '
    With Command1
        .Left = 1
        .Top = 1
        .Width = UserControl.Width
        .Height = UserControl.Height
    End With
    '
End Sub
Now you need to add just a few more routines to complete this portion of the control. First, you need to create a new private subroutine called LoadProperties. This routine moves all the property values onto the frmFind form that displays the selection dialog box. Enter the code from Listing 12.15 into your project.
Type.gifListing 12.15 Coding the LoadProperties subroutine.
Private Sub LoadProperties()
    '
    ' move properties into dialog
    '
    frmFind.Data1.Connect = strConnect
    frmFind.Data1.DatabaseName = strDBName
    frmFind.Data1.RecordSource = strRSName
    frmFind.DBList1.ListField = strListField
    frmFind.DBList1.BoundColumn = strBoundColumn
    frmFind.Data1.Refresh
    frmFind.DBList1.Refresh
    '
End Sub
Note.gif
The LoadProperties routine is declared private so that users of the ActiveX control cannot see and use this routine. The LoadProperties routine is for internal use and should not be called from outside the control's own code space.

Now you need to add code behind the command button that makes it all work. Enter the code from Listing 12.16 in the Command1_Click event of the control.

 
< previous page page_478 next page >

If you like this book, buy it!